<div class="form-group">
    <label><?php echo $fileLabel; ?></label>
    <input type="file" id="<?php echo $fileId; ?>" />
    <?php if ($isImage) : ?>
        <img id="<?php echo $fileId.'_show'; ?>" style="width:<?php echo $imageWidth; ?>;<?php if (!$imageUrl) : ?>display:none;<?php endif; ?>" src = '<?php echo '/images/'.$imageUrl.'.jpg'; ?>' />
    <?php else : ?>
        <a id="<?php echo $fileId.'_show'; ?>" href="" style="display:none;">下载</a>
    <?php endif; ?>
    <input type="hidden" value="<?php echo $imageUrl; ?>" name="<?php echo $fileName; ?>" class="imags" id="<?php echo $fileId.'input' ?>" />
</div>
<script type="text/javascript">
    $("#<?php echo $fileId; ?>").uploadify({
        buttonText : "请选择...",
        fileObjName : "file",
        <?php if ($isImage) : ?>
        fileTypeExts : "*.jpg;*.png;*.gif;*.jpeg;*.bmp",
        <?php endif; ?>
        swf : "/statics/plugins/uploadify/uploadify.swf",
        uploader : "/files/upload",
        multi: false,
        onUploadSuccess: function(file, dataStr, response) {
            var data = eval("(" + dataStr + ")");
            if (typeof(data.error) != "undefined") {
                alert(data.error);
            } else {
                if (<?php echo $isImage; ?>) {
                    $("#<?php echo $fileId. '_show'; ?>").attr("src", '/images/' + data.hash + '.' + data.extension).show();
                    $("#<?php echo $fileId. 'input'; ?>").val(data.hash);
                } else {
                    $("#<?php echo $fileId.'_show'; ?>").attr("href", '/download/' + data.hash).show();
                    $("#<?php echo $fileId. 'input'; ?>").val(data.hash);
                }
            }
        }
    });
</script>